﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using QRCoder;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace Course04.MVC.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WeIController : ControllerBase
    {
        [HttpPost]
        public  void WeiM() 
        {
            //string strCode = "http://www.walys.com";
            //QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
            //QRCodeData qrCodeData = qrGenerator.CreateQrCode(strCode, QRCodeGenerator.ECCLevel.Q);
            //QRCode qrcode = new QRCode(qrCodeData);

            //// qrcode.GetGraphic 方法可参考最下发“补充说明”
            //Bitmap qrCodeImage = qrcode.GetGraphic(5, Color.Black, Color.White, null, 15, 6, false);
            //MemoryStream ms = new MemoryStream();
            //qrCodeImage.Save(ms, ImageFormat.Jpeg);

            //// 如果想保存图片 可使用  qrCodeImage.Save(filePath);

            //// 响应类型
            ////context.Response.ContentType = "image/Jpeg";
            ////输出字符流
            ////context.Response.BinaryWrite(ms.ToArray());
            //Response.ContentType = "image/Jpeg";
            //Response.Body = ms;
            //Response.BodyWriter
        }
    }
}
